package com.example.hyw.szysteam.utils;

import android.support.v7.app.AppCompatActivity;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * Created by HYW on 2018/6/6.
 */

public class ActivityManager {
    private static Map<String,AppCompatActivity> destoryMap=new HashMap<>();

    public static void addDestoryActivity(AppCompatActivity appCompatActivity,String name){
        destoryMap.put(name,appCompatActivity);
    }

    public static void destoryActivity(String activityName){
        Set<String> keySet=destoryMap.keySet();
        if(keySet.size()>0){
            for(String key:keySet){
                if(activityName.equals(key)){
                    destoryMap.get(key).finish();
                }
            }
        }
    }
}
